<template>
  <div class="main">
    <div class="content" v-for="item in img" :key="item.id" @click="handleclick(item.id)">
      <img :src="item.img"/>
      </div>
  </div>
</template>

<script>
import card from '@/components/card'
export default {
  data () {
    return {
     // img:[{img:'../../static/images/test/1.jpg',id:1},
     img:[
       {img:'../../static/images/home1.jpg',id:1},
      {img:'../../static/images/home2.jpg',id:2}],
      //   {img:'http://mpvue.com/assets/logo.png',id:1},
      // {img:'http://mpvue.com/assets/logo.png',id:2}],
      motto: 'Hello miniprograme',
      userInfo: {
        nickName: 'mpvue',
        avatarUrl: 'http://mpvue.com/assets/logo.png'
      }
    }
  },

  components: {
    card,
  },

  methods: {
    handleclick(id){
      switch(id){
        case 1:
         wx.redirectTo(
          {
            url: '../help/main'
          })
        break;
        case 2:
         wx.navigateTo(
          {
            url: '../guidance/main'
          })
        break;
        case 3:
         wx.navigateTo(
          {
            url: '../introduce/main'
          })
        break;
        default:
         wx.navigateTo(
          {
            url: '../introduce/main'
          })
        break;
      }
    },
    bindViewTap () {
      const url = '../logs/main'
      if (mpvuePlatform === 'wx') {
        mpvue.switchTab({ url })
      } else {
        mpvue.navigateTo({ url })
      }
    },
    clickHandle (ev) {
      console.log('clickHandle:', ev)
      // throw {message: 'custom test'}
    }
  },

  created () {
    // let app = getApp()
  }
}
</script>

<style lang="scss" scoped>
  .main{
    height: calc(100vh);
    .content{
      width: 95%;
      height: 29%;
      margin:0 auto;
      margin-top: 5%;
      img{
        height: 100%;
        width:100%;
        border: 1px solid black;
        border-radius: 5px;
      }
    }
  }
</style>
